package com.swl.controller;

import com.swl.pojo.School;
import com.swl.service.SchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/school")
public class SchoolController {
    @Autowired
    private SchoolService schoolService;
    @RequestMapping("/insertSchool")
    @ResponseBody
    public Integer addSchool(School school){
        System.out.println("addSchool执行了");
        System.out.println("====================="+school);
        int i = schoolService.insertSchool(school);
        return i;
    }
    @ResponseBody
    @RequestMapping("/selectAll")
    public List<School> selectAll(){
        System.out.println("查询所有执行了");
        List<School>schools=schoolService.selectAll();
        System.out.println(schools);
        return schools;
    }


}
